import request from "./request"
import qs from 'qs'
// 精品推荐
export const jingPingGetApi = () => request.get('/products/recommend')
// 热门兑换
export const hotGetApi = () => request.get('/products/hot')
// 登录获取验证码
export const GetCodeApi = (p) => request.post('/sendSMS', qs.stringify(p))
// 登录账号
export const DengluApi = (p) => request.post('/phoneRegin', qs.stringify(p))

// 获取用户信息
export const getUserInfoApi = () => request.get('/shop/userProfiles')
// 微信登录
// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginApi = (params) => request.post(`/wechatUsers/PCLogin`, qs.stringify(params));

// 手机绑定微信
export const bindWePhoneApi = (params) => request.post('/wechatUsers/binding', qs.stringify(params) )
// 手机解绑微信/wechatUsers/unbindingWeChat
export const UnbindWechatPhoneApi = () => request.put('/wechatUsers/unbindingWeChat')
// 商品详情/products/{id}
export const GoodsDetailsApi = (params) => request.get(`/products/${params}`)
//加入购物车 /products/{id}
export const GetgoodsApi = (params) => request.post(`/shop/carts/add`,qs.stringify(params))
// 获取用户信息
export const UserInfoApi = () => request.get('/shop/userProfiles')
// 查看购物车/shop/carts
export const LookCartApi = () => request.get('/shop/carts')
// 更多商品
export function getHomeMultidata({max, min, type,keyword}) {
    // console.log(max, min, type);
    return request({
        url: '/products',
        method: 'get',
        params: {
            max, min, type,keyword
        }
    })
}


